package logic

import (
	"github.com/gin-gonic/gin"
	"github.com/vueadmin/app/admin/internal/dto"
	"github.com/vueadmin/app/admin/internal/model"
	"github.com/vueadmin/app/admin/internal/service"
	"github.com/vueadmin/app/admin/internal/svc"
	"github.com/vueadmin/app/admin/internal/vo"
)

type testLogic struct{
	ctx    *gin.Context
	svcCtx *svc.ServiceContext
}

func NewTestLogic(ctx *gin.Context, svcCtx *svc.ServiceContext) *testLogic {
	return &testLogic{
		ctx: ctx,
		svcCtx: svcCtx,
	}
}

/**
 * @description(数据列表)
 * @buildcode(true)
*/
func (p testLogic) GetPageList(req *dto.TestPageReq) ([]*vo.TestList, int64, error) {
	s := service.NewTestService(p.svcCtx)
	return s.GetPageList(req)
}

/**
 * @description(修改排序开关)
 * @buildcode(true)
*/
func (p testLogic) UpdateExt(req map[string]interface{}) error {
	s := service.NewTestService(p.svcCtx)
	return s.UpdateExt(req)
}

/**
 * @description(添加)
 * @buildcode(true)
*/
func (p testLogic) Add(req *dto.TestAddReq) (int, error) {
	s := service.NewTestService(p.svcCtx)
	return s.Add(req)
}

/**
 * @description(修改)
 * @buildcode(true)
*/
func (p testLogic) Update(req *dto.TestUpdateReq) error {
	s := service.NewTestService(p.svcCtx)
	return s.Update(req)
}

/**
 * @description(获取修改详情)
 * @buildcode(true)
*/
func (p testLogic) GetUpdateInfo(req *dto.TestGetUpdateInfoReq) (*model.Test, error) {
	s := service.NewTestService(p.svcCtx)
	return s.GetUpdateInfo(req)
}

/**
 * @description(删除)
 * @buildcode(true)
*/
func (p testLogic) Delete(req *dto.TestDeleteReq) error {
	s := service.NewTestService(p.svcCtx)
	return s.Delete(req)
}

/**
 * @description(查看详情)
 * @buildcode(true)
*/
func (p testLogic) Detail(req *dto.TestDetailReq) (*vo.TestDetail, error) {
	s := service.NewTestService(p.svcCtx)
	return s.Detail(req)
}

/**
 * @description(软删除回收站恢复数据)
 * @buildcode(true)
*/
func (p testLogic) Restore(req *dto.TestRestoreReq) error {
	s := service.NewTestService(p.svcCtx)
	return s.Restore(req)
}

